package com.ihr360.payroll.controller.spreadsheet;

import com.ihr360.excel.constant.Ihr360SpreadSheetConstant;
import com.ihr360.excel.validation.AbstractSpreadSheetValidateController;
import com.ihr360.excel.vo.CustomSpreadSheetValidateResult;
import com.ihr360.excel.vo.SpreadSheetSpecification;
import com.ihr360.excel.vo.SpreadSheetValidatorRequest;
import com.ihr360.maven.plugin.ModuleCodeStore;
import com.ihr360.maven.plugin.annotation.FunctionDefinition;
import com.ihr360.maven.plugin.annotation.ModuleDefinition;
import com.ihr360.shared.advice.response.DisableResponseAdvice;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author richey
 */
@RestController
@RequestMapping(value = Ihr360SpreadSheetConstant.PRE_HTTP_VALIDATE_PATH)
@DisableResponseAdvice
@ModuleDefinition(mainModuleCode = ModuleCodeStore.Module.SALARY_CODE,
        mainModuleName = ModuleCodeStore.Module.SALARY_NAME,
        subModuleCode = ModuleCodeStore.Module.Salary.STAFF_PAY_ROLLINFO_CODE,
        subModuleName = ModuleCodeStore.Module.Salary.STAFF_PAY_ROLLINFO_NAME, isPublic = true)
public class SpreadSheetValidateController extends AbstractSpreadSheetValidateController {

    @PostMapping(value = Ihr360SpreadSheetConstant.HTTP_CUSTOM_VALIDATE_PATH)
    @FunctionDefinition(functionName = "自定义导入校验规则", functionCode = ModuleCodeStore.Function.VIEW, isPublic = true)
    public CustomSpreadSheetValidateResult customValidate(@RequestBody SpreadSheetValidatorRequest request) {
        return super.getCustomValidateResult(request);
    }


    @PostMapping(value = Ihr360SpreadSheetConstant.HTTP_COMMON_VALIDATE_PATH)
    @FunctionDefinition(functionName = "通用导入校验规则", functionCode = ModuleCodeStore.Function.VIEW, isPublic = true)
    public SpreadSheetSpecification commonSpecification(@RequestBody SpreadSheetValidatorRequest request) {
        return super.getCommonSpecification(request);
    }

}

